import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { LinkInterfixVO, LinkInterfixForm, LinkInterfixQuery } from '@/leadmall/api/linkInterfix/types';

/**
 * 查询链接关联列表
 * @param query
 * @returns {*}
 */

export const listLinkInterfix = (query?: LinkInterfixQuery): AxiosPromise<LinkInterfixVO[]> => {
  return request({
    url: PORT +'/leadmall/linkInterfix/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询链接关联详细
 * @param id
 */
export const getLinkInterfix = (id: string | number): AxiosPromise<LinkInterfixVO> => {
  return request({
    url: PORT +'/leadmall/linkInterfix/' + id,
    method: 'get'
  });
};

/**
 * 新增链接关联
 * @param data
 */
export const addLinkInterfix = (data: LinkInterfixForm) => {
  return request({
    url: PORT +'/leadmall/linkInterfix',
    method: 'post',
    data: data
  });
};

/**
 * 修改链接关联
 * @param data
 */
export const updateLinkInterfix = (data: LinkInterfixForm) => {
  return request({
    url: PORT +'/leadmall/linkInterfix',
    method: 'put',
    data: data
  });
};

/**
 * 删除链接关联
 * @param id
 */
export const delLinkInterfix = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/linkInterfix/' + id,
    method: 'delete'
  });
};
